#include <stdio.h>

static unsigned long next = 1;

unsigned int rand() {
  extern unsigned long next;
  next = next * 1103515245 + 12345;
  return (unsigned long)(next / 65536) % 32768;
}

int main() {
  int count = 0;
  while (count < 10) {
    printf("%d\n", rand());
    count++;
  }
}